import * as API from '../axios';
import * as util from "@/common/util";
export default {
  //代理列表
  getAgentList: (params, page) => {
    const url = util.replacePageNumAndSize('/manage/agents/{pageNum}/{pageSize}', page)
    return API.axiosGetAPI(url, params)
  },
  //修改状态
  agentState: params => {
    const headers = {
      'lang-key': params.state == 1 ? 'branch_resumePartnership' : 'branch_Terminate'
    }
    return API.axiosPutAPI('/manage/agents/state', params,headers);
  },
  //代理详情
  agentDetail: id => {
    return API.axiosGetAPI(`/manage/agents/detail/${id}`);
  },
  //下级代理分成详情
  agentLevel: (params, page) => {
    const url = util.replacePageNumAndSize(`/manage/agents/sub-partner/brokerage/{pageNum}/{pageSize}`, page)
    return API.axiosGetAPI(url, params)
  },
  //编辑代理回显
  agentDetails: id => {
    return API.axiosGetAPI(`/manage/agents/edit/${id}`);
  },
  //新增代理
  addAgent: params => {
    const headers = {
      'lang-key': 'branch_Create'
    }
    return API.axiosPostAPI('/manage/agents', params, headers);
  },
  //编辑代理
  editAgent: params => {
    const headers = {
      'lang-key': 'branch_Edit'
    }
    return API.axiosPutAPI('/manage/agents', params, headers);
  },

};